﻿using System;
using System.Collections.Generic;
using System.Globalization;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

public partial class Default : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!Page.IsPostBack)
        {
            SetYearValue();
        }
    }
    private void SetYearValue()
    {
        PersianCalendar persianCalendar = new PersianCalendar();
        YearText.Value= persianCalendar.GetYear(DateTime.Now).ToString();
    }
    protected void PatientButton_Click(object sender, EventArgs e)
    {
        string code = CodeText.Value;
        string phone = PhoneText.Value;
        string year = YearText.Value;
        ///////if (LoginUser.IsSecurePatient(year, PhoneTextBox.Text, CodeTextBox.Text))
        /////////Response.Redirect(string.Format("{0}/{1}/{2}/_Patient", PhoneTextBox.Text, CodeTextBox.Text, year));        
        Response.Redirect(string.Format("Patient/ShowToPatient.aspx?tel={0}&code={1}&year={2}", phone, code, year));
    
    }
    protected void AdminButton_Click(object sender, EventArgs e)
    {
        string userName = UserNameText.Value;
        string password = PasswordText.Value;
        //TODO
        //if (LoginUser.IsSecure(DoctorPassowrdTextBox.Text, DoctorUserNameTextBox.Text, year, 2))
        /////////Response.Redirect(string.Format("{0}/{1}/_Doctor", DoctorUserNameTextBox.Text, year));      
        Response.Redirect("Admin/User.aspx");
    }
    protected void DoctorButton_Click(object sender, EventArgs e)
    {
        string nezamCode = NezamCodeText.Value;
        string doctorPassword = DoctorPasswordText.Value;
        PersianCalendar persianCalendar = new PersianCalendar();
        string year = persianCalendar.GetYear(DateTime.Now).ToString().Replace("13", "");
        year = "88";
        //Doctor => RoleId = 2
        //if (LoginUser.IsSecure(DoctorPassowrdTextBox.Text, DoctorUserNameTextBox.Text, year, 2))
        /////////Response.Redirect(string.Format("{0}/{1}/_Doctor", DoctorUserNameTextBox.Text, year));      
        Response.Redirect(string.Format("Doctor/ShowToDoctor.aspx?username={0}&year={1}", nezamCode, year));
   
    }
}